Calculation of floating-point numbers in PHP and the solution of inaccurate rounding, rounding inaccurate
Comparison of floating-point calculation resultsA floating-point calculation example is as follows:
Copy the Code code as follows:$a = 0.2+0.7;
This article mainly introduces the basic mathematical calculations used in Python programming, which focuses on the use of division operations and related pision modules, the need for friends can refer to the following
NumberIn Python, the
"Problem description"It's a classic game to count 24 points on 4 cards. General requirements are only allowed with subtraction and parentheses for arithmetic.For example: 1,2,3,4 can calculate 24 with the expression (1+2+3)-24.It is required to
Integer divided by integerAfter entering Python interaction mode (later in this tutorial, you may no longer repeat this kind of narration, just see >>>, as shown in interactive mode), practice the Following:2 / 50>>> 2.0 / 50.4>>> 2 / 5.00.4>>> 2.0 /
Computer programming always encounter the problem of the accuracy of floating-point arithmetic, this article through PHP to solve the problem of inaccurate floating-point arithmetic sharing, I hope that we solve the floating-point arithmetic
The division is verbose, not just python.
Integer divided by integer
Reader after you start idle, practice the following operation:
>>> 2/5
0
>>> 2.0/5
0.4
>>> 2/5.0
0.4
>>> 2.0/5.0
0.4
Do you see it? Trouble out, if from elementary
PHP Variables and constants
First, Directory
First chapter variables
1.1 Declaration of variables
1.2 Naming of variables
1.3 The data type of the variable
1.4 Conversion between variable data types
1.5 Some common functions related to
The data types of JavaScript are divided into two categories: primitive type and object type. 5 Primitive types: Number, String, Boolean, null (NULL), undefined (undefined). An object is a collection of properties, each of which consists of a
The data types of JavaScript are divided into two categories: original type and object type. 5 Original types: Number, String, Boolean, null (empty), undefined (undefined). An object is a collection of attributes, each of which is made up of
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.